package com.qingcheng.controller.goods;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.service.goods.StockBackService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.Schedules;
import org.springframework.stereotype.Component;

/**
 * 添加订单错误
 * SKU库存回滚任务
 */
@Component
public class SkuTask {

    @Reference
    private StockBackService stockBackService;

    /**
     * 间隔一个小时进行库存回滚
     */
    @Scheduled(cron = "* * 0/1 * * ?" )
    public void skuStockBack(){
        System.out.println("执行库存回滚");
        stockBackService.doBack();
    }
}
